<?php

namespace app\admin\model;

use think\Model;
use traits\model\SoftDelete;

class Accountlt extends Model
{

    use SoftDelete;

    

    // 表名
    protected $name = 'account';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = 'deletetime';

    // 追加属性
    protected $append = [
        'acc_type_text',
        'is_yajin_text'
    ];
    

    
    public function getAccTypeList()
    {
        return ['1' => __('Acc_type 1'), '2' => __('Acc_type 2'), '3' => __('Acc_type 3'), '4' => __('Acc_type 4'), '0' => __('Acc_type 0')];
    }

    public function getIsYajinList()
    {
        return ['1' => __('Is_yajin 1'), '0' => __('Is_yajin 0')];
    }


    public function getAccTypeTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['acc_type']) ? $data['acc_type'] : '');
        $list = $this->getAccTypeList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getIsYajinTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['is_yajin']) ? $data['is_yajin'] : '');
        $list = $this->getIsYajinList();
        return isset($list[$value]) ? $list[$value] : '';
    }




}
